package com.xdf.controller;

import com.xdf.bean.ResponseVo;
import com.xdf.service.TransferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xudengfeng
 * @date 2020/12/3 20:57
 */

@RestController
public class TransferController {

    @Autowired
    TransferService transferService;

    @RequestMapping("transfer")
    public ResponseVo transfer() {
        String fromName = "boss";
        String toName = "B";
        Double money = 1000.00;

        boolean b = transferService.updateMoneyByName(fromName, toName, money);
        if (b) {
            return ResponseVo.ok(null, "转账成功!");
        }
        return ResponseVo.failed("转账失败！");
    }
}
